#素数的判断
def is_prime(number):
    if number <= 1:
        return False
    for num in range(2,number):
        if number % num == 0:
            return False
    return True

prime = eval(input('请输入一个整数：'))
if is_prime(prime):
    print('是素数')
else:
    print('不是素数')

#九九乘法表
for i in range(1,10):
    for j in range(1,i+i):
         print(f'{j}*{i}={j*i}',end=' ')
    print()

#判断回文数
word = str(input('请输入一串字符：'))
if word == word[::-1]:
    print('是回文数')
else:
    print('不是回文数')

#字符串反转
words = str(input('请输入一串字符：'))
print('反转后的字符串为：',words[::-1])

#斐波那契数列
def fibo(n):
    if n == 0 or n == 1:
        return n
    else:
        return fibo(n-1)+fibo(n-2)

n = eval(input('请输入一个数：'))
fib_list = []

for i in range(n):
    fib_list.append(fibo(i))

print(fib_list)

#计算字符串中单词的个数
words = str(input('请输入一串字符：'))
english_words = 'abcdefghijklmnopqrstuvwsyz'
math_numbers = '01234566789'
count_math = 0
count_english = 0
count_others = 0
for word in words:
    if word in english_words:
        count_english += 1
    elif word in math_numbers:
        count_math += 1
    else:
        count_others += 1
print(f'这一串字符里面有{count_english}个英文单词,有{count_math}个数字,有{count_others}个其他字符。')

#寻找数组的最大值
list_number =input('随便写几个数字(用逗号分隔开)：')
if len(list_number) > 1:
    list_number = list_number.split(',')
    max_number = int(list_number[0])
    min_number = int(list_number[0])
    for num in range(0,len(list_number)):
        if int(list_number[num]) > int(max_number):
            max_number = list_number[num]
        elif int(list_number[num]) < int(min_number):
            min_number = list_number[num]
    print('在这些数字中最大的数字是：{}，最小的数字是：{}'.format(max_number,min_number))
else:
    print('由于只有一个数字，因此最大值和最小值都是{}'.format(list_number))

#判断该年月日是这一年中的第几天
date = input('请输入要查询的年月日(用逗号分隔开):')
date = date.split(',')
year = int(date[0])
month = [0,31,59,90,120,151,181,212,243,273,304,334]
if int(date[1]) < 1 or int(date[1]) > 12:
    print('没有这一天')
else :
    if (year % 400 == 0) or (year % 4 ==0) and (year % 100 != 0):
        if int(date[1]) == 2 and int(date[2]) > 29 or int(date[1]) == 1 and int(date[2]) < 1 or  int(date[1]) == 12 and int(date[2]) > 31:
            print('没有这一天')
        else:
            if int(date[1]) > 3:
                day = month[int(date[1])-1] + int(date[2]) + 1
                print('这个日期是在这一年的第{}天'.format(day))
            else:
                day = month[int(date[1])-1] + int(date[2])
                print('这个日期是在这一年的第{}天'.format(day))
    else:
        if int(date[1]) == 2 and int(date[2]) > 28:
            print('没有这一天')
        else:
            day = month[int(date[1])-1] + int(date[2])
            print('这个日期实在这一年的第{}天'.format(day))